package com.wang.set;

import com.wang.collection.Student;

import java.util.TreeSet;

/**
 * TreeSet的使用
 * 存储结构:红黑树
 */
public class TreeSetDemo2 {
    public static void main(String[] args) {
        TreeSet<Student> treeSet = new TreeSet<>();
        Student s1 = new Student("wang1",1);
        Student s2 = new Student("aa",2);
        Student s3 = new Student("aa",3);
        treeSet.add(s1);
        treeSet.add(s2);
        treeSet.add(s3);
        System.out.println(treeSet.size());
        System.out.println(treeSet.toString());
    }
}
